using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_OnLinePaySeting : Admin, IRequiresSessionState
{
	protected GridView GridView1;
	protected FormView FormView1;
	protected ObjectDataSource ObjectDataSource1;
	protected ObjectDataSource ObjectDataSource2;
	private int PayID = 0;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.IsPostBack)
		{
			this.PayID = Fetch.GetID("pID");
			if (this.PayID > 0 || Fetch.Get("Action") == "add")
			{
				this.FormView1.Visible = true;
				this.GridView1.Visible = false;
				if (Fetch.Get("Action") == "add")
				{
					this.FormView1.DefaultMode = FormViewMode.Insert;
				}
				this.FormView1.DataSourceID = "ObjectDataSource2";
				this.FormView1.DataBind();
			}
			else
			{
				this.BindList();
			}
		}
	}
	protected void BindList()
	{
		this.GridView1.DataSourceID = "ObjectDataSource1";
		this.GridView1.DataBind();
	}
	protected void SetActive(object sender, CommandEventArgs e)
	{
		if (e.CommandArgument != null && e.CommandName != null)
		{
			int num = Convert.ToInt32(e.CommandArgument);
			num = ((num == 1) ? 0 : 1);
			int num2 = Convert.ToInt32(e.CommandName);
			if (num2 > 0)
			{
				OnlinePaySeting onlinePaySeting = new OnlinePaySeting(this.conn);
				onlinePaySeting.SetActive(num2, num);
				this.BindList();
			}
		}
	}
	protected void OnSubmit(object sender, ObjectDataSourceStatusEventArgs e)
	{
		if (e.ReturnValue != null)
		{
			if (e.ReturnValue.ToString().ToLower() == "true")
			{
				this.WriteSuccessMsg("", Language.GetAdminMsg("Common/EditSuccess"), "Admin_OnLinePaySeting.aspx");
			}
			else
			{
				this.WriteErrMsg("", Language.GetAdminMsg("Common/EditFail", "0"), "");
			}
		}
		else
		{
			this.WriteErrMsg("", Language.GetAdminMsg("Common/EditFail", "0"), "");
		}
	}
}
